package com.liyue.web;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.apache.struts2.interceptor.SessionAware;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.interceptor.annotations.Before;

/**
 * 展现层基类，所有action均继承该action
 * 
 * @author liyue
 * @version BaseAction.java Nov 4, 2011 2:36:26 PM
 */
public class BaseAction extends ActionSupport implements SessionAware,
		ServletRequestAware, ServletResponseAware {

	private static final long serialVersionUID = -2521026016299139301L;

	protected Map<String, Object> session;
	protected HttpServletRequest request;
	protected HttpServletResponse response;

	@Override
	public void setSession(Map<String, Object> session) {
		this.session = session;
	}

	public Map<String, Object> getSession() {
		return session;
	}

	public void setServletRequest(HttpServletRequest request) {
		this.request = request;
	}

	public void setServletResponse(HttpServletResponse response) {
		this.response = response;
	}

	/**
	 * @return the response
	 */
	public HttpServletResponse getResponse() {
		return response;
	}

	/**
	 * 请求之前执行
	 * 
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	@Before
	public void prepare() throws Exception {
	}

}
